home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ghostscript.idb / usr / freeware / doc / ghostscript / 3.33 / fonts.doc.z / fonts.doc
Encoding:
Text File  |  1998-05-21  |  16.7 KB  |  381 lines

  1.    Copyright (C) 1990, 1991, 1993, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of GNU Ghostscript.
  4.   
  5.   GNU Ghostscript is distributed in the hope that it will be useful, but
  6.   WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility to
  7.   anyone for the consequences of using it or for whether it serves any
  8.   particular purpose or works at all, unless he says so in writing.  Refer
  9.   to the GNU Ghostscript General Public License for full details.
  10.   
  11.  
  12. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  13.  
  14. This file, fonts.doc, describes the fonts and font facilities supplied
  15. with Ghostscript.
  16.  
  17. For an overview of Ghostscript and a list of the documentation files, see
  18. README.
  19.  
  20. About Ghostscript fonts
  21. =======================
  22.  
  23. Most of Ghostscript's font files have a .gsf extension.  Each file defines
  24. one (transformable) font specified in outline form.  They are ordinary
  25. Type 1 PostScript outline fonts, and can be given to any PostScript
  26. language interpreter; however, they are not compatible with Adobe Type
  27. Manager or with tools that don't include a full PostScript language
  28. interpreter.  Ghostscript also includes a few files with .pfa extension,
  29. which *are* compatible with Adobe Type Manager.
  30.  
  31. The other font-related file that Ghostscript needs for proper operation is
  32. a file called Fontmap.  This file maps font names (such as /Times-Roman)
  33. to font file names (such as ptmr.gsf).
  34.  
  35. Most of the fonts supplied with Ghostscript are based on various public
  36. domain bitmap fonts, primarily the ones supplied with the X11 distribution
  37. from MIT, and on the public domain Hershey fonts.  The fonts are
  38. distributed in the file `ghostscript-N.NNfonts.tar.Z'.  The bitmap-derived
  39. fonts include the usual Helvetica, Times-Roman, and so on; see the file
  40. `Fontmap' for the complete list, in the usual roman, italic, bold, and
  41. bold italic styles (for the most part).  The Hershey fonts, on the other
  42. hand, are quite different from traditional ones; the file `hershey.doc'
  43. describes them in more detail.
  44.  
  45. The file gs_fonts.ps, which is loaded as part of Ghostscript
  46. initialization, arranges to load fonts on demand using the information
  47. from Fontmap.  If you want to preload all of the known fonts, invoke the
  48. procedure
  49.     loadallfonts
  50. This is not done by default, since the fonts occupy about 50K each and there
  51. are a lot of them.
  52.  
  53. Ghostscript fonts are actually ordinary Ghostscript programs: they use the
  54. extension .gsf instead of .ps simply to be informative.  This convention
  55. is only embodied in the Fontmap file: there is no code that knows about
  56. it.
  57.  
  58. If you want to try out the fonts, prfont.ps contains code for printing a
  59. sampler.  Load this program, by including it in the gs command line or by
  60. invoking
  61.     (prfont.ps) run
  62. and then to produce a sampler of a particular font, invoke
  63.     /fontName DoFont
  64. e.g.
  65.     /Times-Roman DoFont
  66.  
  67. About the Kanji fonts
  68. ---------------------
  69.  
  70. Mr. Tetsurou Tanaka of the Department of Engineering, University of Tokyo,
  71. has created a set of free Kanji fonts that is freely available on the
  72. Internet for anonymous FTP from moe.ipl.t.u-tokyo.ac.jp:/Font and is
  73. distributed with Ghostscript.  Anyone can use these fonts as they are or
  74. with some format translation, and redistribute them without reporting.  If
  75. you redistribute them, you must inform the recipient that he can get the
  76. original from the abovementioned FTP site, so that he could get the newest
  77. version later.
  78.  
  79. The fonts include a README file in Japanese.  Here is some English
  80. documentation supplied by Mr. Kiyotaka Sakai, also of the University of
  81. Tokyo.
  82.  
  83.     The following four fonts are different styles of the same characters
  84.     (JISX208). These fonts also needs wadalab-sym.tar.Z in common.
  85.  
  86.     wadalab-mincho-0-8.tar.gz
  87.     wadalab-mincho-0-12.6.tar.gz
  88.     wadalab-gothic-0-13.5.tar.gz
  89.     wadalab-maru-0-8.4.tar.gz
  90.  
  91.     And the following two fonts are the other different styles of the same
  92.     characters(JISX0212).
  93.  
  94.     wadalab-mincho-1-8.tar.gz
  95.     wadalab-maru-1-8.tar.gz
  96.  
  97.     These fonts are postscript(type1) fonts. You can convert them to
  98.     Metafont, Type1(PFA) font, TeX font(for japanese TeX), BDF font,
  99.     Shotaikurabu font by using wftomf.c, wftopfa.c, wftodm.c, bdfmerge.c
  100.     wftovf.c in tools directory.
  101.  
  102. In order to conform to MS-DOS naming restrictions, we have renamed the
  103. original font files as follows:
  104.     Name        Original name
  105.     ----        -------------
  106.     got013-5.taz    wadalab-gothic-0-13.5.tar.gz
  107.     mar08-4.taz    wadalab-maru-0-8.4.tar.gz
  108.     mar18.taz    wadalab-maru-1-8.tar.gz
  109.     min012-6.taz    wadalab-mincho-0-12.6.tar.gz
  110.     min08-4.taz    wadalab-mincho-0-8.4.tar.gz
  111.     min18.taz    wadalab-mincho-1-8.tar.gz
  112.     sym-4.taz    wadalab-sym.4.tar.gz
  113.  
  114. Platform fonts
  115. ==============
  116.  
  117. Starting with release 2.6.1, Ghostscript uses whatever font technology is
  118. provided by the system on which it runs, by using the system's API for
  119. displaying text.  On MS Windows this may be TrueType, or it may be ATM;
  120. Ghostscript neither knows nor cares.  Note that Ghostscript does not
  121. contain a TrueType rasterizer, so it cannot read disk files containing
  122. TrueType fonts; don't put the names of TrueType font files (.FON or .TTF
  123. or .PTF whatever they are called) in Ghostscript's Fontmap.
  124.  
  125. The PostScript language specifies that fonts are data structures with
  126. particular contents (e.g., they include a bounding box for the font, an
  127. Encoding vector for specifying the character set, etc.), and it is fairly
  128. common for PostScript files to make use of this fact; also, characters can
  129. be used as clipping regions, and can be arbitrarily rotated, skewed,
  130. expanded/condensed, etc. algorithmically.  Most of this information is
  131. available in one form or another from the underlying graphics system, but
  132. one crucial piece is not: the actual scalable outlines of the characters,
  133. which Ghostscript needs in order to implement clipping with character
  134. shapes and to implement arbitrarily transformed characters.  Consequently,
  135.  
  136.     Ghostscript needs the scalable outlines of any font mentioned
  137.     in a document, and will load them from the disk (.PFA, .PFB, or
  138.     .GSF file) in the usual way, even if it uses the platform's font
  139.     machinery for displaying the characters.
  140.  
  141. To make matters worse, platforms use different names for their standard
  142. fonts.  For example, the Times Roman font, for which PostScript files use
  143. the name "Times-Roman", may be known as "Times-Roman", "Times Roman", "Tms
  144. Rmn", "Times New Roman", or "TimesNewRoman".  The name may even be
  145. completely different: the usual Helvetica-equivalent TrueType font is
  146. called "Arial".  Now, it is possible to cope with this situation by
  147. introducing aliases in Fontmap, but there are two reasons why the
  148. current Ghostscript release does not do this:
  149.  
  150.     1) Naming in different systems is so unstandardized that there
  151. does not seem to be a small set of alternative names that is likely to
  152. cover most of the situations.  All 5 of the above names for Times Roman
  153. have been seen in Windows and OS/2 environments, depending on system
  154. version, TrueType vs.  ATM, and other unknown factors.
  155.  
  156.     2) Each alias takes up a substantial amount of space (several
  157. hundred bytes) at run time.  If each of the standard 35 fonts has 3
  158. additional aliases, this might amount to 50K of wasted space.  This is a
  159. lot on a PC, although running under Windows in enhanced mode, it might not
  160. be a problem.
  161.  
  162. If you don't seem to be getting nice characters on the screen under MS
  163. Windows, you can try adding aliases to the Fontmap, according to the
  164. documentation found there.
  165.  
  166. Adding your own fonts
  167. =====================
  168.  
  169. Ghostscript can use any Type 1 or Type 3 font that is acceptable to other
  170. PostScript language interpreters.  Ghostscript also provides a way to
  171. construct a Type 1 font from a bitmap font in BDF format, which is a
  172. popular format in the Unix world.
  173.  
  174. If you want to add fonts of your own, you must edit Fontmap to include an
  175. entry for your new font at the end.  The format for entries is documented
  176. in the Fontmap file.  Since later entries in Fontmap override earlier
  177. entries, any fonts you add will supersede the corresponding fonts supplied
  178. with Ghostscript.
  179.  
  180. In the PC world, Type 1 fonts are customarily given names ending in .PFA
  181. or .PFB.  Ghostscript can use these directly; you just need to make the
  182. entry in Fontmap.  If you are going to use a commercial Type 1 font (such
  183. as fonts obtained in conjunction with Adobe Type Manager) with
  184. Ghostscript, please read carefully the license that accompanies the font;
  185. Aladdin Enterprises takes no responsibility for any possible violations of
  186. such licenses.
  187.  
  188. Converting BDF fonts
  189. --------------------
  190.  
  191. If you want to convert a BDF file to a scalable outline, use the program
  192. bdftops.ps (and invoking shell script bdftops.bat or bdftops).  Run the
  193. shell command
  194.     bdftops <BDF_file_name> [<AFM_file1_name> ...] <your_gsf_file_name>
  195.       <font_name> <uniqueID> [<XUID>] [<encoding_name>]
  196. e.g.,
  197.     bdftops pzdr.bdf ZapfDingbats.afm pzdr.gsf
  198.       ZapfDingbats 4100000 1000000.1.41
  199. (Obviously, you would enter this all on one line; the example is split so
  200. it will fit on the page.)  Then make an entry for the .gsf file in Fontmap
  201. as described above.  You may find it helpful to read, and to add an entry
  202. to, the fonts.mak file, which is a makefile for converting the standard
  203. Ghostscript fonts.
  204.  
  205. For developers only
  206. ===================
  207.  
  208. The rest of this document is very unlikely to be of value to ordinary
  209. users.
  210.  
  211. Contents of fonts
  212. -----------------
  213.  
  214. A Ghostscript font is a dictionary with a standard set of keys as follows.
  215. The keys marked with a * have the same meanings as in P*stScr*pt fonts;
  216. those marked with # have the same meanings as in Adobe Type 1 fonts.  Note
  217. that FontName is required, and StrokeWidth is required for all stroked or
  218. outlined fonts.
  219.  
  220. *    - FontMatrix <array>: the transformation from character
  221.       coordinates to user coordinates.
  222.  
  223. *    - FontType <integer>: the type of the font, either 1 or 3.
  224.  
  225. *    - FontBBox <array>: the bounding box of the font.
  226.  
  227. *    - Encoding <array>: the map from character codes to character
  228.       names.
  229.  
  230. *    - FontName <name>: the name of the font.
  231.  
  232. *    - PaintType <integer>: an indication of how to interpret the
  233.       character description from CharInfo.
  234.  
  235. *    - StrokeWidth <number>: the stroke width for outline fonts.
  236.  
  237. *    - FontInfo <dictionary>: additional information about the font
  238.       (optional, not used by the standard Ghostscript software).
  239.  
  240. *    - UniqueID <integer>: a unique number identifying the font.
  241.  
  242. *    - BuildChar <procedure>: the procedure for showing a character
  243.       (not required in type 1 fonts).
  244.  
  245. #    - CharStrings <dictionary>: the map from character names to character
  246.       descriptions (relevant only in type 1 fonts).
  247.  
  248. #    - Private <dictionary>: additional information used by the
  249.       algorithms for rendering outlines fonts (relevant only in type 1
  250.       fonts).
  251.  
  252. The format of values in the CharStrings and Private dictionaries are
  253. described in the Adobe Type 1 Font Format book.
  254.  
  255. Precompiling fonts
  256. ------------------
  257.  
  258. You can compile any Type 1 font into C and link it into the Ghostscript
  259. executable.  (Type 1 fonts include any font whose name ends with .pfa or
  260. .pfb, and it also includes all the Ghostscript .gsf fonts except for the
  261. Hershey fonts.)  This doesn't have any effect on rendering speed, but it
  262. eliminates the time for loading the font dynamically, which may make a big
  263. difference in total rendering time, especially for multi-page documents.
  264. (Because of RAM and compiler limitations, you should only use compiled
  265. fonts on MS-DOS systems if you are using a 32-bit compiler such as Watcom
  266. C/386 or djgpp; you will run out of memory if you use compiled fonts with
  267. the Borland compiler.)  Fonts that have been precompiled and linked in
  268. this way do not need to appear in the Fontmap, although if they do appear
  269. there, no harm is done.
  270.  
  271. The utility for precompiling fonts is called font2c.  Note that font2c is
  272. a PostScript language program, so you must have Ghostscript already
  273. running to be able to run font2c; you must also have entries in the
  274. Fontmap for the fonts you want to compile.  For example, to precompile
  275. the Times-Italic font,
  276.     font2c Times-Italic ptmri.c
  277. where the first argument is the font name and the second is the name of
  278. the .c file.  You can use any file name you want, as long as it ends in
  279. .c.  It doesn't have to be limited to 8 characters, unless your operating
  280. system requires this.  We suggest that you use names xxxx.c, where
  281. xxxx.gsf or xxxx.pfa is the name of the font file in the Fontmap file,
  282. just so you don't have to keep track of another set of names.  (If you are
  283. running on a VMS platform, or another platform where the C compiler has a
  284. limit on the length of identifiers, you must do something slightly more
  285. complicated; see the section 'Platforms with identifier length limits'
  286. below.  Also, on VMS, you must put quotes "" around the font name so that
  287. the VMS command processor doesn't convert the name to lower case.)
  288.  
  289. For VMS environments, see the directions in the file make.doc, and ignore
  290. the rest of this section.
  291.  
  292. Note that ncrr.c, ptmr.c, etc. are not supplied with the Ghostscript
  293. fileset, since they are quite large and can easily be recreated using the
  294. font2c program as described above.  There is a makefile called cfonts.mak
  295. that will run font2c on all the fonts supplied with Ghostscript.  Invoke it
  296. with
  297.     make -f cfonts.mak
  298. On some systems, you may have to omit the space following the -f, i.e.,
  299.     make -fcfonts.mak
  300.  
  301. Besides running font2c, you must arrange things so that the fonts will be
  302. compiled, and linked into the executable.  To do this, add the compiled
  303. fonts "feature" to your platform-specific makefile.  On MS-DOS systems, you
  304. edit tc.mak, bc.mak, bcwin.mak, msc.mak, or watc.mak; on Unix systems, you
  305. edit makefile.  Find the definition of FEATURE_DEVS in the makefile, e.g.,
  306.     FEATURE_DEVS=filter.dev dps.dev
  307. Add ccfonts.dev on the end, e.g.,
  308.     FEATURE_DEVS=filter.dev dps.dev ccfonts.dev
  309.  
  310. Next, you must add the specific fonts to the generic makefile.  On MS-DOS
  311. systems, you edit gs.mak; on Unix systems, you edit makefile.  The makefile
  312. already has rules for the standard 35 fonts supplied with Ghostscript.
  313. Find the line in the relevant makefile that says
  314.     #ccfonts1_=<something>
  315. Remove the # mark from this line, and from all the following lines down to
  316. and including the one that says
  317.     #ccfonts9=<something>
  318. This is all you need to do for the standard fonts.  The next couple of
  319. paragraphs describe how to compile in other fonts, such as the Utopia or
  320. Kana fonts or your own fonts.
  321.  
  322. Suppose you want to compile the Kana fonts into the executable.  First,
  323. pick one of ccfonts10 through 15 as the place you will do this, say
  324. ccfonts10.  Add your compiled font file names, e.g.,
  325.     ccfonts10_=fhirw.$(OBJ)
  326. If the line gets too long, use another line of the same form, e.g.,
  327.     ccfonts11_=fkarw.$(OBJ)
  328. Just below this, you will find a line that says
  329.     ccfonts10_=
  330. Add your own fonts to the end of this line, e.g.,
  331.     ccfonts10=Calligraphic_Hiragana
  332. Notice that you must replace `-' by `_' in the font name.  Again, if
  333. the line gets too long, add another line of the same form, e.g.,
  334.     ccfonts10=Calligraphic_Hiragana
  335.     ccfonts11=Calligraphic_Katakana
  336.  
  337. After all the lines of this form, add a pair of lines to compile each font,
  338. separating these entries from the ccfonts* lines and from each other by a
  339. blank line.  In our example:
  340.  
  341.     fhirw.$(OBJ): fhirw.c $(CCFONT)
  342.         $(CCCF) fhirw.c
  343.  
  344.     fkarw.$(OBJ): fkarw.c $(CCFONT)
  345.         $(CCCF) fkarw.c
  346.  
  347. Finally, run `make'.  The executable will now include the fonts you added.
  348. They will be present in FontDirectory when Ghostscript starts up.
  349.  
  350. Precompiling fonts on platforms with identifier length limits
  351. -------------------------------------------------------------
  352.  
  353. On some platforms, the C compiler and/or linker have a limit on the number
  354. of significant characters in an identifier.  On such platforms, you must
  355. do a little extra work.
  356.  
  357. Let N be the maximum number of significant characters in an identifier
  358. (typically 31).  For each font whose name is longer than N-5 characters,
  359. pick an arbitrary identifier that we will call the "short name".  This can
  360. be any string you want, as long as it contains only letters, digits, and
  361. underscores; is no longer than N-5 characters; and is not the same as any
  362. other font name or short name.  A good choice for this would be to use the
  363. name of the C file.  (There is no harm in doing this for fonts with names
  364. shorter than N-5 characters, it's just not necessary.)
  365.  
  366. You must do two different things for fonts that require a short name.
  367. First, you must supply the short name as a third argument to the font2c
  368. program.  For example, to compile NewCenturySchlbk-BoldItalic using the
  369. short name "pncbi",
  370.     font2c NewCenturySchlbk-BoldItalic pncbi.c pncbi
  371. Then when you add the font to the gsaddmod line in the makefile, use the
  372. short name, not the actual font name, e.g.,
  373.     ccfonts2=pncbi
  374. instead of
  375.     ccfonts2=NewCenturySchlbk_BoldItalic
  376. Everything else is as described above.
  377.  
  378. This procedure doesn't change the name of the font in the Fontmap, or as
  379. seen from within Ghostscript; it's just a workaround for a limitation of
  380. some older compilers.
  381.